Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ignore tag images option #39

Merged
merged 1 commit into from
Mar 20, 2024

Conversation

kitagry
Copy link
Contributor

@kitagry kitagry commented Mar 20, 2024

Closes #33

Sometimes, I want to ignore only tag changes because it is a bit noisy. So, I created the option.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 82.07547% with 19 lines in your changes are missing coverage. Please review.

Project coverage is 71.37%. Comparing base (14efcda) to head (22a84c9).

Files Patch % Lines
src/parser.rs 90.62% 9 Missing ⚠️
src/config.rs 0.00% 7 Missing ⚠️
src/main.rs 0.00% 3 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #39      +/-   ##
==========================================
+ Coverage   70.07%   71.37%   +1.29%     
==========================================
  Files           7        7              
  Lines         665      758      +93     
==========================================
+ Hits          466      541      +75     
- Misses        199      217      +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Owner

@hirosassa hirosassa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great!

Comment on lines +377 to 434
#[test]
fn test_ignore_image_tags() {
let diff = "
@@ -50,7 +48,7 @@
- configMapRef:
name: configmap
- image: image:latest@sha256:19adf91
+ image: image:latest
";
let parser = self::DiffParser::new(true, Vec::new()).unwrap();
let actual = parser.remove_image_tags(diff, "image");
let expected = "
@@ -50,7 +48,7 @@
- configMapRef:
name: configmap
";
assert_eq!(actual, expected);
}

#[test]
fn test_ignore_image_tags_with_no_label() {
let diff = "
@@ -50,7 +48,7 @@
- configMapRef:
name: configmap
- image: image:latest@sha256:19adf91
+ image: image
";
let parser = self::DiffParser::new(true, Vec::new()).unwrap();
let actual = parser.remove_image_tags(diff, "image");
let expected = "
@@ -50,7 +48,7 @@
- configMapRef:
name: configmap
";
assert_eq!(actual, expected);
}

#[test]
fn test_donot_ignore_image_tags_when_image_was_changed() {
let diff = "
@@ -50,7 +48,7 @@
- configMapRef:
name: configmap
- image: image:latest
+ image: other:latest
";
let parser = self::DiffParser::new(true, Vec::new()).unwrap();
let actual = parser.remove_image_tags(diff, "image");
let expected = "
@@ -50,7 +48,7 @@
- configMapRef:
name: configmap
- image: image:latest
+ image: other:latest
";
assert_eq!(actual, expected);
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice test suits! Thanks!

@hirosassa hirosassa merged commit 53b7216 into hirosassa:main Mar 20, 2024
6 checks passed
@hirosassa
Copy link
Owner

@kitagry I'll create new release including this change. Wait a minute.

@kitagry kitagry deleted the ignore-tag-names branch March 20, 2024 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: Add --ignore-image-tag option
3 participants